﻿Imports Phila
Imports Phila.Sql
Imports Phila.CommonClasses
Imports Telerik.WebControls

Public Class ViewUsers
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub radGrid_DeleteCommand(ByVal source As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs) Handles radGrid.DeleteCommand
        Dim ID As String = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ID").ToString
        Try
            Insert_Update_Delete_Record("delete from ptn_users where id=" & ID)
        Catch ex As Exception
            'radGrid.Controls.Add(New LiteralControl(("Unable to Delete Record. Reason: " + ex.Message)))
            lblMsg.Text = "Unable to Delete Record. Reason: " + ex.Message
            lblMsg.ForeColor = Drawing.Color.Red
            e.Canceled = True
        End Try
    End Sub

    Protected Sub radGrid_NeedDataSource(ByVal source As Object, ByVal e As Telerik.WebControls.GridNeedDataSourceEventArgs) Handles radGrid.NeedDataSource
        Fill_Grid(radGrid, "select Id, (FirstName + ' ' + LastName) Name, Email, IsActive, ClientType from ptn_users where IsAdmin=0 order by Id desc")
    End Sub

End Class